#! /bin/bash

set -x

image_name="python-with-package:latest"
image_file="python-with-package.tar"
remote_direcotry="/root/zabbix-notify/zabbix/"

docker build . -t ${image_name} -f Dockerfile-with-packages
[ -f ../${image_file} ] && rm ../${image_file}
docker save ${image_name} -o ../${image_file}
sshpass -p "Chery@suse" scp ../${image_file} root@10.104.14.27:${remote_direcotry}
# sshpass -p "Chery@suse" scp -r /mnt/d/Dev/zabbix/ root@10.104.14.27:${remote_direcotry}
sshpass -p 'Chery@suse' sshpass -p 'Chery@suse' rsync -avr /mnt/d/Dev/zabbix/ root@10.104.14.27:/root/zabbix-notify/zabbix/

sshpass -p "Chery@suse" ssh root@10.104.14.27 "docker image ls ${image_name} && docker rmi ${image_name}"
sshpass -p "Chery@suse" ssh root@10.104.14.27 "docker load -i ${remote_direcotry}${image_file}"